.class public Lcom/estrongs/android/pop/app/editor/b;
.super Ljava/io/Reader;
.source "AccessFileReader.java"


# instance fields
.field private a:Lcom/estrongs/android/pop/app/editor/a;

.field private b:Z

.field private c:Ljava/nio/charset/CharsetDecoder;

.field private final d:Ljava/nio/ByteBuffer;


# direct methods
.method public constructor <init>(Landroid/content/Context;Ljava/io/File;Ljava/lang/String;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/UnsupportedEncodingException;,
            Ljava/io/FileNotFoundException;
        }
    .end annotation

    .line 1
    invoke-direct {p0, p2}, Ljava/io/Reader;-><init>(Ljava/lang/Object;)V

    const/4 v0, 0x0

    .line 2
    iput-boolean v0, p0, Lcom/estrongs/android/pop/app/editor/b;->b:Z

    const/16 v1, 0x2000

    .line 3
    invoke-static {v1}, Ljava/nio/ByteBuffer;->allocate(I)Ljava/nio/ByteBuffer;

    move-result-object v1

    iput-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    if-eqz p3, :cond_0

    :try_start_0
    const-string v1, "r"

    .line 4
    invoke-static {p1, p2, v1}, Lcom/estrongs/android/pop/app/editor/a;->a(Landroid/content/Context;Ljava/io/File;Ljava/lang/String;)Lcom/estrongs/android/pop/app/editor/a;

    move-result-object p1

    iput-object p1, p0, Lcom/estrongs/android/pop/app/editor/b;->a:Lcom/estrongs/android/pop/app/editor/a;

    .line 5
    invoke-static {p3}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;

    move-result-object p1

    invoke-virtual {p1}, Ljava/nio/charset/Charset;->newDecoder()Ljava/nio/charset/CharsetDecoder;

    move-result-object p1

    sget-object p2, Ljava/nio/charset/CodingErrorAction;->REPLACE:Ljava/nio/charset/CodingErrorAction;

    invoke-virtual {p1, p2}, Ljava/nio/charset/CharsetDecoder;->onMalformedInput(Ljava/nio/charset/CodingErrorAction;)Ljava/nio/charset/CharsetDecoder;

    move-result-object p1

    sget-object p2, Ljava/nio/charset/CodingErrorAction;->REPLACE:Ljava/nio/charset/CodingErrorAction;

    .line 6
    invoke-virtual {p1, p2}, Ljava/nio/charset/CharsetDecoder;->onUnmappableCharacter(Ljava/nio/charset/CodingErrorAction;)Ljava/nio/charset/CharsetDecoder;

    move-result-object p1

    iput-object p1, p0, Lcom/estrongs/android/pop/app/editor/b;->c:Ljava/nio/charset/CharsetDecoder;
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0

    .line 7
    iget-object p1, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {p1, v0}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;

    return-void

    :catch_0
    move-exception p1

    .line 8
    new-instance p2, Ljava/io/UnsupportedEncodingException;

    invoke-direct {p2, p3}, Ljava/io/UnsupportedEncodingException;-><init>(Ljava/lang/String;)V

    .line 9
    invoke-virtual {p2, p1}, Ljava/io/UnsupportedEncodingException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    move-result-object p1

    check-cast p1, Ljava/io/UnsupportedEncodingException;

    throw p1

    :cond_0
    const/4 p1, 0x0

    .line 10
    throw p1
.end method

.method private isOpen()Z
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/estrongs/android/pop/app/editor/b;->a:Lcom/estrongs/android/pop/app/editor/a;

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    :goto_0
    return v0
.end method


# virtual methods
.method public b()Ljava/lang/String;
    .locals 1

    .line 1
    invoke-direct {p0}, Lcom/estrongs/android/pop/app/editor/b;->isOpen()Z

    move-result v0

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/estrongs/android/pop/app/editor/b;->c:Ljava/nio/charset/CharsetDecoder;

    if-nez v0, :cond_0

    goto :goto_0

    .line 2
    :cond_0
    invoke-virtual {v0}, Ljava/nio/charset/CharsetDecoder;->charset()Ljava/nio/charset/Charset;

    move-result-object v0

    invoke-virtual {v0}, Ljava/nio/charset/Charset;->name()Ljava/lang/String;

    move-result-object v0

    return-object v0

    :cond_1
    :goto_0
    const/4 v0, 0x0

    return-object v0
.end method

.method public b(J)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 3
    iget-object v0, p0, Ljava/io/Reader;->lock:Ljava/lang/Object;

    monitor-enter v0

    .line 4
    :try_start_0
    iget-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->a:Lcom/estrongs/android/pop/app/editor/a;

    if-eqz v1, :cond_0

    .line 5
    iget-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->a:Lcom/estrongs/android/pop/app/editor/a;

    invoke-virtual {v1, p1, p2}, Lcom/estrongs/android/pop/app/editor/a;->a(J)V

    .line 6
    iget-object p1, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;

    .line 7
    iget-object p1, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    const/4 p2, 0x0

    invoke-virtual {p1, p2}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;

    .line 8
    monitor-exit v0

    return-void

    .line 9
    :cond_0
    new-instance p1, Ljava/io/IOException;

    const-string p2, "InputStreamReader is closed"

    invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p1

    :catchall_0
    move-exception p1

    .line 10
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1
.end method

.method public close()V
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Ljava/io/Reader;->lock:Ljava/lang/Object;

    monitor-enter v0

    .line 2
    :try_start_0
    iget-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->c:Ljava/nio/charset/CharsetDecoder;

    if-eqz v1, :cond_0

    .line 3
    iget-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->c:Ljava/nio/charset/CharsetDecoder;

    invoke-virtual {v1}, Ljava/nio/charset/CharsetDecoder;->reset()Ljava/nio/charset/CharsetDecoder;

    :cond_0
    const/4 v1, 0x0

    .line 4
    iput-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->c:Ljava/nio/charset/CharsetDecoder;

    .line 5
    iget-object v2, p0, Lcom/estrongs/android/pop/app/editor/b;->a:Lcom/estrongs/android/pop/app/editor/a;

    if-eqz v2, :cond_1

    .line 6
    iget-object v2, p0, Lcom/estrongs/android/pop/app/editor/b;->a:Lcom/estrongs/android/pop/app/editor/a;

    invoke-virtual {v2}, Lcom/estrongs/android/pop/app/editor/a;->a()V

    .line 7
    iput-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->a:Lcom/estrongs/android/pop/app/editor/a;

    .line 8
    :cond_1
    monitor-exit v0

    return-void

    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method

.method public getPosition()J
    .locals 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Ljava/io/Reader;->lock:Ljava/lang/Object;

    monitor-enter v0

    .line 2
    :try_start_0
    iget-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->a:Lcom/estrongs/android/pop/app/editor/a;

    if-eqz v1, :cond_0

    .line 3
    iget-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->a:Lcom/estrongs/android/pop/app/editor/a;

    invoke-virtual {v1}, Lcom/estrongs/android/pop/app/editor/a;->c()J

    move-result-wide v1

    iget-object v3, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v3}, Ljava/nio/ByteBuffer;->limit()I

    move-result v3

    iget-object v4, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v4}, Ljava/nio/ByteBuffer;->position()I

    move-result v4

    sub-int/2addr v3, v4

    int-to-long v3, v3

    sub-long/2addr v1, v3

    monitor-exit v0

    return-wide v1

    .line 4
    :cond_0
    new-instance v1, Ljava/io/IOException;

    const-string v2, "InputStreamReader is closed"

    invoke-direct {v1, v2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v1

    :catchall_0
    move-exception v1

    .line 5
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method

.method public read()I
    .locals 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Ljava/io/Reader;->lock:Ljava/lang/Object;

    monitor-enter v0

    .line 2
    :try_start_0
    invoke-direct {p0}, Lcom/estrongs/android/pop/app/editor/b;->isOpen()Z

    move-result v1

    if-eqz v1, :cond_1

    const/4 v1, 0x1

    new-array v2, v1, [C

    const/4 v3, 0x0

    .line 3
    invoke-virtual {p0, v2, v3, v1}, Lcom/estrongs/android/pop/app/editor/b;->read([CII)I

    move-result v1

    const/4 v4, -0x1

    if-eq v1, v4, :cond_0

    aget-char v4, v2, v3

    :cond_0
    monitor-exit v0

    return v4

    .line 4
    :cond_1
    new-instance v1, Ljava/io/IOException;

    const-string v2, "InputStreamReader is closed"

    invoke-direct {v1, v2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v1

    :catchall_0
    move-exception v1

    .line 5
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method

.method public read([CII)I
    .locals 8
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 6
    iget-object v0, p0, Ljava/io/Reader;->lock:Ljava/lang/Object;

    monitor-enter v0

    .line 7
    :try_start_0
    invoke-direct {p0}, Lcom/estrongs/android/pop/app/editor/b;->isOpen()Z

    move-result v1

    if-eqz v1, :cond_b

    const/4 v1, 0x0

    if-nez p3, :cond_0

    .line 8
    monitor-exit v0

    return v1

    .line 9
    :cond_0
    invoke-static {p1, p2, p3}, Ljava/nio/CharBuffer;->wrap([CII)Ljava/nio/CharBuffer;

    move-result-object p1

    .line 10
    sget-object p3, Ljava/nio/charset/CoderResult;->UNDERFLOW:Ljava/nio/charset/CoderResult;

    .line 11
    iget-object v2, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v2}, Ljava/nio/ByteBuffer;->hasRemaining()Z

    move-result v2

    const/4 v3, 0x1

    if-nez v2, :cond_1

    goto/16 :goto_1

    :cond_1
    const/4 v2, 0x0

    .line 12
    :goto_0
    invoke-virtual {p1}, Ljava/nio/CharBuffer;->hasRemaining()Z

    move-result v4

    const/4 v5, -0x1

    if-eqz v4, :cond_6

    if-eqz v2, :cond_4

    .line 13
    iget-object v2, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v2}, Ljava/nio/ByteBuffer;->capacity()I

    move-result v2

    iget-object v4, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v4}, Ljava/nio/ByteBuffer;->limit()I

    move-result v4

    sub-int/2addr v2, v4

    .line 14
    iget-object v4, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v4}, Ljava/nio/ByteBuffer;->arrayOffset()I

    move-result v4

    iget-object v6, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v6}, Ljava/nio/ByteBuffer;->limit()I

    move-result v6

    add-int/2addr v4, v6

    .line 15
    iget-object v6, p0, Lcom/estrongs/android/pop/app/editor/b;->a:Lcom/estrongs/android/pop/app/editor/a;

    iget-object v7, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v7}, Ljava/nio/ByteBuffer;->array()[B

    move-result-object v7

    invoke-virtual {v6, v7, v4, v2}, Lcom/estrongs/android/pop/app/editor/a;->a([BII)I

    move-result v2

    if-ne v2, v5, :cond_2

    .line 16
    iput-boolean v3, p0, Lcom/estrongs/android/pop/app/editor/b;->b:Z

    goto :goto_2

    :cond_2
    if-nez v2, :cond_3

    goto :goto_2

    .line 17
    :cond_3
    iget-object p3, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    iget-object v4, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v4}, Ljava/nio/ByteBuffer;->limit()I

    move-result v4

    add-int/2addr v4, v2

    invoke-virtual {p3, v4}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;

    .line 18
    :cond_4
    iget-object p3, p0, Lcom/estrongs/android/pop/app/editor/b;->c:Ljava/nio/charset/CharsetDecoder;

    iget-object v2, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {p3, v2, p1, v1}, Ljava/nio/charset/CharsetDecoder;->decode(Ljava/nio/ByteBuffer;Ljava/nio/CharBuffer;Z)Ljava/nio/charset/CoderResult;

    move-result-object p3

    .line 19
    invoke-virtual {p3}, Ljava/nio/charset/CoderResult;->isUnderflow()Z

    move-result v2

    if-eqz v2, :cond_6

    .line 20
    iget-object v2, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v2}, Ljava/nio/ByteBuffer;->limit()I

    move-result v2

    iget-object v4, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v4}, Ljava/nio/ByteBuffer;->capacity()I

    move-result v4

    if-ne v2, v4, :cond_5

    .line 21
    iget-object v2, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v2}, Ljava/nio/ByteBuffer;->compact()Ljava/nio/ByteBuffer;

    .line 22
    iget-object v2, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    iget-object v4, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v4}, Ljava/nio/ByteBuffer;->position()I

    move-result v4

    invoke-virtual {v2, v4}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;

    .line 23
    iget-object v2, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {v2, v1}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;

    :cond_5
    :goto_1
    const/4 v2, 0x1

    goto :goto_0

    .line 24
    :cond_6
    :goto_2
    sget-object v1, Ljava/nio/charset/CoderResult;->UNDERFLOW:Ljava/nio/charset/CoderResult;

    if-ne p3, v1, :cond_7

    iget-boolean v1, p0, Lcom/estrongs/android/pop/app/editor/b;->b:Z

    if-eqz v1, :cond_7

    .line 25
    iget-object p3, p0, Lcom/estrongs/android/pop/app/editor/b;->c:Ljava/nio/charset/CharsetDecoder;

    iget-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->d:Ljava/nio/ByteBuffer;

    invoke-virtual {p3, v1, p1, v3}, Ljava/nio/charset/CharsetDecoder;->decode(Ljava/nio/ByteBuffer;Ljava/nio/CharBuffer;Z)Ljava/nio/charset/CoderResult;

    move-result-object p3

    .line 26
    iget-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->c:Ljava/nio/charset/CharsetDecoder;

    invoke-virtual {v1, p1}, Ljava/nio/charset/CharsetDecoder;->flush(Ljava/nio/CharBuffer;)Ljava/nio/charset/CoderResult;

    .line 27
    iget-object v1, p0, Lcom/estrongs/android/pop/app/editor/b;->c:Ljava/nio/charset/CharsetDecoder;

    invoke-virtual {v1}, Ljava/nio/charset/CharsetDecoder;->reset()Ljava/nio/charset/CharsetDecoder;

    .line 28
    :cond_7
    invoke-virtual {p3}, Ljava/nio/charset/CoderResult;->isMalformed()Z

    move-result v1

    if-nez v1, :cond_8

    invoke-virtual {p3}, Ljava/nio/charset/CoderResult;->isUnmappable()Z

    move-result v1

    if-eqz v1, :cond_9

    .line 29
    :cond_8
    invoke-virtual {p3}, Ljava/nio/charset/CoderResult;->throwException()V

    .line 30
    :cond_9
    invoke-virtual {p1}, Ljava/nio/CharBuffer;->position()I

    move-result p3

    sub-int/2addr p3, p2

    if-nez p3, :cond_a

    goto :goto_3

    :cond_a
    invoke-virtual {p1}, Ljava/nio/CharBuffer;->position()I

    move-result p1

    sub-int v5, p1, p2

    :goto_3
    monitor-exit v0

    return v5

    .line 31
    :cond_b
    new-instance p1, Ljava/io/IOException;

    const-string p2, "InputStreamReader is closed"

    invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p1

    :catchall_0
    move-exception p1

    .line 32
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    goto :goto_5

    :goto_4
    throw p1

    :goto_5
    goto :goto_4
.end method

.method public ready()Z
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    new-instance v0, Ljava/io/IOException;

    invoke-direct {v0}, Ljava/io/IOException;-><init>()V

    throw v0
.end method
